<template>
  <a-modal
    title="消息详情"
    :visible="visible"
    :maskClosable="false"
    :keyboard="false"
    :width="600"
    :footer="null"
    @cancel="handleCancel"
  >
    <a-form :form="form" :labelCol="labelCol" :wrapperCol="wrapperCol">
      <a-form-item label="应用">
        <span>{{appName}}</span>
      </a-form-item>
      <a-form-item label="模板升级CODE">
        <span>{{code}}</span>
      </a-form-item>
      <a-form-item label="模板消息CODE">
        <span>{{templateCode}}</span>
      </a-form-item>
      <a-form-item label="参数">
        <span>{{parametersJson}}</span>
      </a-form-item>
      <a-form-item label="创建时间">
        <span>{{notificationTime}}</span>
      </a-form-item>
      <a-form-item label="执行周期">
        <span>{{cycle}}</span>
      </a-form-item>
      <a-form-item label="当前执行层级">
        <span>{{level}}</span>
      </a-form-item>
      <a-form-item label="状态">
        <span>{{status === 0 ? '未执行' : '已执行'}}</span>
      </a-form-item>
    </a-form>
  </a-modal>
</template>

<script>
export default {
  name: 'NoticeDetailModal',
  data(){
    return {
      visible: false,
      labelCol: {
        xs: { span: 24 },
        sm: { span: 10 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 14 }
      },
      form: this.$form.createForm(this),
      appName: '',
      code: '',
      cycle: '',
      level: '',
      parametersJson: '',
      status: 0,
      templateCode: '',
      notificationTime: ''
    }
  },
  methods: {
    show(record){
      this.visible = true;
      const {
        appName, code, cycle, level, parametersJson, status, templateCode, notificationTime
      } = record;
      this.appName = appName
      this.code = code
      this.cycle = cycle
      this.level = level
      this.parametersJson = parametersJson
      this.status = status
      this.templateCode = templateCode
      this.notificationTime = notificationTime
    },

    handleCancel(){
      this.visible = false;
    }
  }
}
</script>

<style>

</style>